<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\web\NotFoundHttpException;

//chỉ người dùng đã đăng ký mới có quyền xem
if(Yii::$app->user->isGuest)
{
	throw new NotFoundHttpException('The requested page does not exist.');
}
else
{

	/* @var $this yii\web\View */
	/* @var $model app\models\Project */

	$this->title = $model->name;
	//$this->params['breadcrumbs'][] = ['label' => 'Projects', 'url' => ['index']];
	//$this->params['breadcrumbs'][] = $this->title;
	?>
	<div class="project-view">

		<h1><?= Html::encode($this->title) ?></h1>
<?php
	//chỉ admin mới có quyền xóa/sửa
	if(!Yii::$app->user->isGuest && Yii::$app->user->identity->acc_type==0)
	{
?>

		<p>
			<?= Html::a('Cập nhật', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
			<?= Html::a('Xóa', ['delete', 'id' => $model->id], [
				'class' => 'btn btn-danger',
				'data' => [
					'confirm' => 'Are you sure you want to delete this item?',
					'method' => 'post',
				],
			]) ?>
		</p>
<?php
	}
?>
		<?= DetailView::widget([
			'model' => $model,
			'attributes' => [
				'id',
				'name',
				'rate',
				'description:ntext',
				'guide:ntext',
				'link:url',
			],
		]) ?>

	</div>
<?php
}
?>